package com.iwhalecloud.citybrain.flow.platform.manager.domain.model;

import com.iwhalecloud.citybrain.flow.platform.manager.domain.repository.FlowReModelCustomConfigRepository;
import lombok.Data;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Service;

import java.io.Serializable;
import java.util.List;

/**
 * @author lilh
 * @date 2021/6/7 10:00
 */
@Data
@Service
public class ModelCustomConfigDomain implements Serializable, ApplicationContextAware {


    private static final long serialVersionUID = 6052441791601417167L;

    static FlowReModelCustomConfigRepository flowReModelCustomConfigRepository;
    /**
     * 主键
     */
    private Long id;

    /**
     * 部署id
     */
    private String deploymentId;

    /**
     * 用来标记不同类型的配置
     */
    private String type;

    /**
     * 节点编码
     */
    private String nodeCode;

    /**
     * 配置信息
     */
    private String config;

    /**
     * 流程编码
     */
    private String flowCode;

    public void save(){
        flowReModelCustomConfigRepository.save(this);
    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        flowReModelCustomConfigRepository = applicationContext.getBean(FlowReModelCustomConfigRepository.class);
    }
}